package com.juzi.enumeration;

public class Introduce {
    public static void main(String[] args) {
        System.out.println("==============================\n" +
                "枚举的概述\n" +
                "枚举是Java中的一种特殊类型\n" +
                "枚举的作用：\"是为了做信息的标志和信息的分类\"。\n" +
                "-------------------------------------\n" +
                "定义枚举类的格式：\n" +
                " 修饰符 enum 枚举名称{\n" +
                "            第一行都是罗列枚举类实例的名称。\n" +
                "}\n" +
                "\n" +
                "enum Season{\n" +
                "    SPRING , SUMMER , AUTUMN , WINTER;\n" +
                "}\n" +
                "-------------------------------------\n" +
                "反编译后观察枚举的特征：\n" +
                "enum Season{\n" +
                "    SPRING , SUMMER , AUTUMN , WINTER;\n" +
                "}\n" +
                "\n" +
                "Compiled from \"Season.java\"\n" +
                "public final class Season extends java.lang.Enum<Season> {\n" +
                "    public static final Season SPRING = new Season();\n" +
                "    public static final Season SUMMER = new Season();\n" +
                "    public static final Season AUTUMN = new Season();\n" +
                "    public static final Season WINTER = new Season();\n" +
                "    public static Season[] values();\n" +
                "    public static Season valueOf(java.lang.String);\n" +
                "}\n" +
                "-------------------------------------\n" +
                "枚举的特征：\n" +
                "枚举类都是继承了枚举类型：java.lang.Enum\n" +
                "枚举都是最终类，不可以被继承。\n" +
                "构造器都是私有的，枚举对外不能创建对象。\n" +
                "枚举类的第一行默认都是罗列枚举对象的名称的。\n" +
                "枚举类相当于是多例模式。\n" +
                "-------------------------------------\n" +
                "案例说明：\n" +
                "现在开发的超级玛丽游戏需要接收用户输入的四个方向的信号（上下左右），以便控制玛丽移动的方向。\n" +
                "\n" +
                "选择常量做信息标志和分类：\n" +
                "虽然可以实现可读性，但是入参值不受约束，代码相对不够严谨。\n" +
                "\n" +
                "枚举做信息标志和分类：\n" +
                "代码可读性好，入参约束严谨，代码优雅，是最好的信息分类技术！建议使用!\n" +
                "");
    }
}
